#ifndef BASKETBALL_FILTER_H
#define BASKETBALL_FILTER_H

#include <message_filters/synchronizer.h>
#include <message_filters/subscriber.h>
#include <message_filters/sync_policies/approximate_time.h>
#include <sensor_msgs/Image.h>
#include <sensor_msgs/Imu.h>
#include <boost/bind.hpp>
#include <ros/ros.h>
#include <string>
#include <iostream>
#include <fstream>
#include <ros/package.h>
#include <boost/filesystem.hpp>

class SensorSyncCheker
{
public:
    SensorSyncCheker();
    ~SensorSyncCheker();

    void syncCB1(const sensor_msgs::ImageConstPtr& rgb_img_msg,
                const sensor_msgs::ImageConstPtr& depth_img_msg);

    void syncCB2(const sensor_msgs::ImageConstPtr& rgb_img_msg,
                 const sensor_msgs::ImageConstPtr& depth_img_msg,
                 const sensor_msgs::ImuConstPtr& imu_msg);
    void summarize();
private:
    ros::NodeHandle private_nh_;
    bool use_imu;
    std::string rgb_img_topic;
    std::string depth_img_topic;
    std::string imu_topic;
    ros::Time last_sync;
    bool is_first_sync;
    double report_thresh_str;
    ros::Duration report_thresh;
    size_t drops;
    size_t frame_cnt;
    ros::Duration total_diff;

    std::ofstream ofs;
    std::string csv_path;
};



#endif // BASKETBALL_FILTER_H
